//
//  HomeViewController.m
//  Medicine.Power
//
//  Created by 钟毅灵 on 15/8/3.
//  Copyright (c) 2015年 钟毅灵. All rights reserved.
//

#import "HomeViewController.h"
#import <TAPageControl.h>
#import "SelectCityWithSearchBarView.h"

@interface HomeViewController () <UISearchBarDelegate, UISearchControllerDelegate, UIScrollViewDelegate, UITableViewDelegate>

@property (nonatomic, strong) SelectCityWithSearchBarView *cityWithSearchView;

@property (nonatomic, strong) UIScrollView *bannerView;
@property (nonatomic, strong) TAPageControl *taPageControl;

@property (nonatomic, strong) UITableView *medicineTableView;
@end

@implementation HomeViewController

#pragma mark life cycle
- (void)viewDidLoad {
    [super viewDidLoad];   
    
    [self setleftBarItem];
    
//    [self.view addSubview:self.cityWithSearchView];
    
    [self layoutPageSubviews];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark event response

#pragma mark getter and setter
- (SelectCityWithSearchBarView *) cityWithSearchView {
    if (!_cityWithSearchView) {
        _cityWithSearchView = [SelectCityWithSearchBarView new];
        _cityWithSearchView.userInteractionEnabled = YES;
        
        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] init];
        [_cityWithSearchView addGestureRecognizer:tapGesture];
        
        [[tapGesture rac_gestureSignal] subscribeNext:^(id x) {
            NSLog(@"test");
        }];
         
    }
    return _cityWithSearchView;
}

#pragma mark private method
- (void) setleftBarItem {
    UIBarButtonItem *b5 = [[UIBarButtonItem alloc] initWithCustomView:self.self.cityWithSearchView];
    [self.navigationItem setLeftBarButtonItem:b5];
    
}

#pragma mark Contraints
- (void) layoutPageSubviews {
    
}

@end
